build: Move gdk/tests/ to testsuite/gdk/
authorBenjamin Otte <otte@redhat.com>
Tue, 14 May 2013 14:13:16 +0000 (16:13 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 15 May 2013 13:37:16 +0000 (15:37 +0200)
This is a reorganization of the testsuite to be in the testsuite/
directory, so it can be installed from there.

24 files changed:
Makefile.am
configure.ac
gdk/Makefile.am
gdk/tests/Makefile.am [deleted file]
gdk/tests/check-gdk-cairo.c [deleted file]
gdk/tests/display.c [deleted file]
gdk/tests/display.test.in [deleted file]
gdk/tests/encoding.c [deleted file]
gdk/tests/encoding.test.in [deleted file]
gdk/tests/keysyms.c [deleted file]
gdk/tests/keysyms.test.in [deleted file]
gdk/tests/rgba.c [deleted file]
gdk/tests/rgba.test.in [deleted file]
testsuite/Makefile.am [new file with mode: 0644]
testsuite/gdk/Makefile.am [new file with mode: 0644]
testsuite/gdk/check-gdk-cairo.c [new file with mode: 0644]
testsuite/gdk/display.c [new file with mode: 0644]
testsuite/gdk/display.test.in [new file with mode: 0644]
testsuite/gdk/encoding.c [new file with mode: 0644]
testsuite/gdk/encoding.test.in [new file with mode: 0644]
testsuite/gdk/keysyms.c [new file with mode: 0644]
testsuite/gdk/keysyms.test.in [new file with mode: 0644]
testsuite/gdk/rgba.c [new file with mode: 0644]
testsuite/gdk/rgba.test.in [new file with mode: 0644]

index 285785fee89f444c324cb38efbb4399c4e4d024d..281b67d4f09874481ddf09303afa6fe31ab841f9 100644 (file)
@@ -1,7 +1,7 @@
 ## Makefile.am for GTK+
 include $(top_srcdir)/Makefile.decl
 
-SRC_SUBDIRS = gdk gtk libgail-util modules demos tests perf examples
+SRC_SUBDIRS = gdk gtk libgail-util modules demos tests testsuite perf examples
 SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build
 
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
index 9b90e3800985bf3eea3261ca1e0d06a0c5d9c2ff..6ee3c05731e7fda74b02c8be1aa9f57a51c9c304 100644 (file)
@@ -1785,6 +1785,8 @@ tests/css/Makefile
 tests/css/parser/Makefile
 tests/reftests/Makefile
 tests/visuals/Makefile
+testsuite/Makefile
+testsuite/gdk/Makefile
 docs/Makefile
 docs/reference/Makefile
 docs/reference/gdk/Makefile
@@ -1807,7 +1809,6 @@ gdk/win32/rc/Makefile
 gdk/win32/rc/gdk.rc
 gdk/quartz/Makefile
 gdk/wayland/Makefile
-gdk/tests/Makefile
 gdk/gdkversionmacros.h
 gtk/Makefile
 gtk/makefile.msc
index 379ea28af15f7df707d928b878ab783991ef7659..7cdae7d57a189ed7afca6c84050e21ba4800778d 100644 (file)
@@ -9,9 +9,9 @@ INTROSPECTION_COMPILER_ARGS = \
    --includedir=$(srcdir) \
    --includedir=.
 
-SUBDIRS = $(GDK_BACKENDS) . tests
+SUBDIRS = $(GDK_BACKENDS) .
 
-DIST_SUBDIRS = win32 x11 quartz broadway wayland tests
+DIST_SUBDIRS = win32 x11 quartz broadway wayland
 
 CLEANFILES =
 
diff --git a/gdk/tests/Makefile.am b/gdk/tests/Makefile.am
deleted file mode 100644 (file)
index bd9a3b3..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-include $(top_srcdir)/Makefile.decl
-
-NULL=
-
-noinst_PROGRAMS = $(TEST_PROGS)
-
-AM_CPPFLAGS = \
-       $(GDK_DEP_CFLAGS) \
-       -I$(top_srcdir) \
-       -I$(top_builddir)/gdk \
-       $(NULL)
-
-progs_ldadd = \
-       $(GDK_DEP_LIBS) \
-       $(top_builddir)/gdk/libgdk-3.la \
-       $(NULL)
-
-#TEST_PROGS              += check-gdk-cairo
-#check_gdk_cairo_SOURCES  = check-gdk-cairo.c
-#check_gdk_cairo_LDADD    = $(progs_ldadd)
-
-TEST_PROGS   += rgba
-rgba_SOURCES  = rgba.c
-rgba_LDADD    = $(progs_ldadd)
-
-TEST_PROGS        += encoding
-encoding_SOURCES   = encoding.c
-encoding_LDADD     = $(progs_ldadd)
-
-TEST_PROGS        += display
-display_SOURCES    = display.c
-display_LDADD      = $(progs_ldadd)
-
-TEST_PROGS        += keysyms
-keysyms_SOURCES    = keysyms.c
-keysyms_LDADD      = $(progs_ldadd)
-
-CLEANFILES = \
-       cairosurface.png        \
-       gdksurface.png
-
-if BUILDOPT_INSTALL_TESTS
-insttestdir=$(pkglibexecdir)/installed-tests
-insttest_PROGRAMS = $(TEST_PROGS)
-
-substitutions = \
-       -e s,@pkglibexecdir\@,$(pkglibexecdir),g \
-       $(NULL)
-
-test_in_files = \
-       rgba.test.in \
-       encoding.test.in \
-       display.test.in \
-       keysyms.test.in \
-       $(NULL)
-
-test_files = $(test_in_files:.test.in=.test)
-
-$(test_files): %.test: %.test.in
-       $(AM_V_GEN) sed $(substitutions) $< > $@.tmp && mv $@.tmp $@
-
-EXTRA_DIST += $(test_in_files)
-
-testmetadir = $(datadir)/installed-tests/$(PACKAGE)
-testmeta_DATA = $(test_files)
-endif
-
--include $(top_srcdir)/git.mk
diff --git a/gdk/tests/check-gdk-cairo.c b/gdk/tests/check-gdk-cairo.c
deleted file mode 100644 (file)
index cc7987c..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* This file is part of GTK+
- *
- * AUTHORS
- *     Sven Herzberg
- *
- * Copyright (C) 2008  Sven Herzberg
- *
- * This work is provided "as is"; redistribution and modification
- * in whole or in part, in any medium, physical or electronic is
- * permitted without restriction.
- *
- * This work is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * In no event shall the authors or contributors be liable for any
- * direct, indirect, incidental, special, exemplary, or consequential
- * damages (including, but not limited to, procurement of substitute
- * goods or services; loss of use, data, or profits; or business
- * interruption) however caused and on any theory of liability, whether
- * in contract, strict liability, or tort (including negligence or
- * otherwise) arising in any way out of the use of this software, even
- * if advised of the possibility of such damage.
- */
-
-#include <glib/gstdio.h>
-#include <gdk/gdk.h>
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
-#include <cairo-quartz.h>
-#endif
-
-static void
-test (cairo_t* cr)
-{
-       cairo_save (cr);
-        cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
-        cairo_paint (cr);
-       cairo_restore (cr);
-
-       cairo_move_to (cr, 10.0, 20.0);
-       cairo_line_to (cr, 10.0, 30.0);
-       cairo_stroke (cr);
-
-       cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
-       cairo_arc (cr, 0.0, 0.0, 10.0, 0.0, G_PI/2);
-       cairo_stroke (cr);
-}
-
-static void
-test_surface_orientation (void)
-{
-       cairo_surface_t *surface;
-       GdkPixbuf* pixbuf;
-       GdkPixbuf* pbuf_platform;
-       GdkPixbuf* pbuf_imagesrf;
-       GError   * error = NULL;
-       cairo_surface_t* surface;
-       cairo_t* cr;
-       guchar* data_platform;
-       guchar* data_imagesrf;
-       guint i;
-
-       /* create "platform.png" via native cairo surface */
-       surface = gdk_window_create_similar_surface (gdk_get_default_root_window (),
-                                                     CAIRO_CONTENT_COLOR,
-                                                     100,
-                                                     80);
-       cr = cairo_create (surface);
-       test (cr);
-       cairo_destroy (cr);
-
-       pixbuf = gdk_pixbuf_get_from_surface (NULL,
-                                             surface,
-                                             0, 0,
-                                             0, 0,
-                                             100, 80);
-       if (!gdk_pixbuf_save (pixbuf, "gdksurface.png", "png", NULL, NULL)) {
-               g_error ("Eeek! Couldn't save the file \"gdksurface.png\"");
-       }
-       g_object_unref (pixbuf);
-
-       cairo_surface_destroy (surface);
-
-       /* create "cairosurface.png" via pure cairo */
-#ifndef CAIRO_HAS_QUARTZ_SURFACE
-       surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 100, 80);
-#else
-       surface = cairo_quartz_surface_create (CAIRO_FORMAT_RGB24, 100, 80);
-#endif
-       cr = cairo_create (surface);
-       test (cr);
-       cairo_destroy (cr);
-       if (CAIRO_STATUS_SUCCESS != cairo_surface_write_to_png (surface, "cairosurface.png")) {
-               g_error ("Eeek! Couldn't save the file \"cairosurface.png\"");
-       }
-       cairo_surface_destroy (surface);
-
-       /* compare the images */
-       pbuf_platform = gdk_pixbuf_new_from_file ("gdksurface.png", &error);
-       if (!pbuf_platform || error) {
-               g_error ("Eeek! Error loading \"gdksurface.png\"");
-       }
-       pbuf_imagesrf = gdk_pixbuf_new_from_file ("cairosurface.png", &error);
-       if (!pbuf_imagesrf || error) {
-               g_object_unref (pbuf_platform);
-               g_error ("Eeek! Error loading \"cairosurface.png\"");
-       }
-
-       g_assert (gdk_pixbuf_get_width (pbuf_platform) ==
-                 gdk_pixbuf_get_width (pbuf_imagesrf));
-       g_assert (gdk_pixbuf_get_height (pbuf_platform) ==
-                 gdk_pixbuf_get_height (pbuf_imagesrf));
-       g_assert (gdk_pixbuf_get_rowstride (pbuf_platform) ==
-                 gdk_pixbuf_get_rowstride (pbuf_imagesrf));
-       g_assert (gdk_pixbuf_get_n_channels (pbuf_platform) ==
-                 gdk_pixbuf_get_n_channels (pbuf_imagesrf));
-
-       data_platform = gdk_pixbuf_get_pixels (pbuf_platform);
-       data_imagesrf = gdk_pixbuf_get_pixels (pbuf_imagesrf);
-
-       for (i = 0; i < gdk_pixbuf_get_height (pbuf_platform) * gdk_pixbuf_get_rowstride (pbuf_platform); i++) {
-               if (data_platform[i] != data_imagesrf[i]) {
-                       g_warning ("Eeek! Images are differing at byte %d", i);
-                       g_object_unref (pbuf_platform);
-                       g_object_unref (pbuf_imagesrf);
-                       g_assert_not_reached ();
-               }
-       }
-
-       g_object_unref (pbuf_platform);
-       g_object_unref (pbuf_imagesrf);
-
-       g_unlink ("gdksurface.png");
-       g_unlink ("cairosurface.png");
-}
-
-int
-main (int   argc,
-      char**argv)
-{
-       g_test_init (&argc, &argv, NULL);
-       gdk_init (&argc, &argv);
-
-       g_test_add_func ("/gdk/surface/orientation",
-                        test_surface_orientation);
-
-       return g_test_run ();
-}
-
diff --git a/gdk/tests/display.c b/gdk/tests/display.c
deleted file mode 100644 (file)
index b4f64ac..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <stdlib.h>
-
-#include <gdk/gdk.h>
-
-static void
-test_unset_display (void)
-{
-  if (g_test_trap_fork (0, 0))//G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
-    {
-      GdkDisplayManager *manager;
-
-      g_unsetenv ("DISPLAY");
-
-      g_assert (!gdk_init_check (NULL, NULL));
-      manager = gdk_display_manager_get ();
-      g_assert (manager != NULL);
-      g_assert (gdk_display_manager_get_default_display (manager) == NULL);
-
-      exit (0);
-    }
-  g_test_trap_assert_passed ();
-
-  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
-    {
-      g_unsetenv ("DISPLAY");
-
-      gdk_init (NULL, NULL);
-
-      exit (0);
-    }
-  g_test_trap_assert_failed ();
-  g_test_trap_assert_stderr ("*cannot open display*");
-}
-
-static void
-test_bad_display (void)
-{
-  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
-    {
-      GdkDisplayManager *manager;
-
-      g_setenv ("DISPLAY", "poo", TRUE);
-
-      g_assert (!gdk_init_check (NULL, NULL));
-      manager = gdk_display_manager_get ();
-      g_assert (manager != NULL);
-      g_assert (gdk_display_manager_get_default_display (manager) == NULL);
-
-      exit (0);
-    }
-  g_test_trap_assert_passed ();
-
-  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
-    {
-      g_setenv ("DISPLAY", "poo", TRUE);
-
-      gdk_init (NULL, NULL);
-
-      exit (0);
-    }
-  g_test_trap_assert_failed ();
-  g_test_trap_assert_stderr ("*cannot open display*");
-}
-
-int
-main (int argc, char *argv[])
-{
-  g_test_init (&argc, &argv, NULL);
-
-  g_test_add_func ("/display/unset-display", test_unset_display);
-  g_test_add_func ("/display/bad-display", test_bad_display);
-
-  return g_test_run ();
-}
diff --git a/gdk/tests/display.test.in b/gdk/tests/display.test.in
deleted file mode 100644 (file)
index 9875c68..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[Test]
-Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/display"
-Type=session
diff --git a/gdk/tests/encoding.c b/gdk/tests/encoding.c
deleted file mode 100644 (file)
index 546bf29..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <gdk/gdk.h>
-#ifdef GDK_WINDOWING_X11
-#include <gdk/x11/gdkx.h>
-#endif
-
-static void
-test_to_text_list (void)
-{
-  GdkDisplay *display;
-
-  display = gdk_display_get_default ();
-
-#ifdef GDK_WINDOWING_X11
-  if (GDK_IS_X11_DISPLAY (display))
-    {
-      GdkAtom encoding;
-      gint format;
-      const guchar *text;
-      gint length;
-      gchar **list;
-      gint n;
-
-      encoding = gdk_atom_intern ("UTF8_STRING", FALSE);
-      format = 8;
-      text = (const guchar*)"abcdef \304\201 \304\205\0ABCDEF \304\200 \304\204";
-      length = 25;
-      n = gdk_x11_display_text_property_to_text_list (display, encoding, format, text, length, &list);
-      g_assert_cmpint (n, ==, 2);
-      g_assert (g_str_has_prefix (list[0], "abcdef "));
-      g_assert (g_str_has_prefix (list[1], "ABCDEF "));
-
-      gdk_x11_free_text_list (list);
-    }
-#endif
-}
-
-int
-main (int argc, char *argv[])
-{
-  g_test_init (&argc, &argv, NULL);
-  gdk_init (&argc, &argv);
-
-  g_test_add_func ("/encoding/to-text-list", test_to_text_list);
-
-  return g_test_run ();
-}
diff --git a/gdk/tests/encoding.test.in b/gdk/tests/encoding.test.in
deleted file mode 100644 (file)
index 06a329d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[Test]
-Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/encoding"
-Type=session
diff --git a/gdk/tests/keysyms.c b/gdk/tests/keysyms.c
deleted file mode 100644 (file)
index 7d786f5..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <locale.h>
-#include <gdk/gdk.h>
-
-static void
-test_keysyms_basic (void)
-{
-  struct {
-    guint keyval;
-    const gchar *name;
-    const gchar *other_name;
-  } tests[] = {
-    { GDK_KEY_space, "space", NULL },
-    { GDK_KEY_a, "a", NULL },
-    { GDK_KEY_Thorn, "Thorn", "THORN" },
-    { GDK_KEY_Hangul_J_RieulTieut, "Hangul_J_RieulTieut", NULL },
-    { GDK_KEY_Page_Up, "Page_Up", NULL },
-    { GDK_KEY_KP_Multiply, "KP_Multiply", NULL },
-    { GDK_KEY_MonBrightnessUp, "MonBrightnessUp", NULL },
-    { 0, NULL }
-  };
-  gint i;
-
- for (i = 0; tests[i].keyval != 0; i++)
-   {
-     g_assert_cmpstr (gdk_keyval_name (tests[i].keyval), ==, tests[i].name);
-     g_assert_cmpuint (gdk_keyval_from_name (tests[i].name), ==, tests[i].keyval);
-     if (tests[i].other_name)
-       g_assert_cmpuint (gdk_keyval_from_name (tests[i].other_name), ==, tests[i].keyval);
-   }
-}
-
-static void
-test_keysyms_void (void)
-{
-  g_assert_cmpuint (gdk_keyval_from_name ("NoSuchKeysym"), ==, GDK_KEY_VoidSymbol);
-  g_assert_cmpstr (gdk_keyval_name (GDK_KEY_VoidSymbol), ==, "0xffffff");
-}
-
-static void
-test_keysyms_xf86 (void)
-{
-  g_assert_cmpuint (gdk_keyval_from_name ("XF86MonBrightnessUp"), ==, GDK_KEY_MonBrightnessUp);
-  g_assert_cmpuint (gdk_keyval_from_name ("XF86MonBrightnessDown"), ==, GDK_KEY_MonBrightnessDown);
-  g_assert_cmpuint (gdk_keyval_from_name ("XF86KbdBrightnessUp"), ==, GDK_KEY_KbdBrightnessUp);
-  g_assert_cmpuint (gdk_keyval_from_name ("XF86KbdBrightnessDown"), ==, GDK_KEY_KbdBrightnessDown);
-  g_assert_cmpuint (gdk_keyval_from_name ("XF86Battery"), ==, GDK_KEY_Battery);
-  g_assert_cmpuint (gdk_keyval_from_name ("XF86Display"), ==, GDK_KEY_Display);
-
-  g_assert_cmpuint (gdk_keyval_from_name ("MonBrightnessUp"), ==, GDK_KEY_MonBrightnessUp);
-  g_assert_cmpuint (gdk_keyval_from_name ("MonBrightnessDown"), ==, GDK_KEY_MonBrightnessDown);
-  g_assert_cmpuint (gdk_keyval_from_name ("KbdBrightnessUp"), ==, GDK_KEY_KbdBrightnessUp);
-  g_assert_cmpuint (gdk_keyval_from_name ("KbdBrightnessDown"), ==, GDK_KEY_KbdBrightnessDown);
-  g_assert_cmpuint (gdk_keyval_from_name ("Battery"), ==, GDK_KEY_Battery);
-  g_assert_cmpuint (gdk_keyval_from_name ("Display"), ==, GDK_KEY_Display);
-}
-
-int main (int argc, char *argv[])
-{
-  setlocale (LC_ALL, "");
-
-  g_test_init (&argc, &argv, NULL);
-  gdk_init (&argc, &argv);
-
-  g_test_add_func ("/keysyms/basic", test_keysyms_basic);
-  g_test_add_func ("/keysyms/void", test_keysyms_void);
-  g_test_add_func ("/keysyms/xf86", test_keysyms_xf86);
-
-  return g_test_run ();
-}
diff --git a/gdk/tests/keysyms.test.in b/gdk/tests/keysyms.test.in
deleted file mode 100644 (file)
index 2f1ce97..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[Test]
-Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/keysyms"
-Type=session
diff --git a/gdk/tests/rgba.c b/gdk/tests/rgba.c
deleted file mode 100644 (file)
index fa2da62..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#include <locale.h>
-#include <gdk/gdk.h>
-
-static void
-test_color_parse (void)
-{
-  GdkRGBA color;
-  GdkRGBA expected;
-  gboolean res;
-
-  res = gdk_rgba_parse (&color, "foo");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "");
-  g_assert (!res);
-
-  expected.red = 100/255.;
-  expected.green = 90/255.;
-  expected.blue = 80/255.;
-  expected.alpha = 0.1;
-  res = gdk_rgba_parse (&color, "rgba(100,90,80,0.1)");
-  g_assert (res);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  expected.red = 0.4;
-  expected.green = 0.3;
-  expected.blue = 0.2;
-  expected.alpha = 0.1;
-  res = gdk_rgba_parse (&color, "rgba(40%,30%,20%,0.1)");
-  g_assert (res);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  res = gdk_rgba_parse (&color, "rgba(  40 % ,  30 %  ,   20 % ,  0.1    )");
-  g_assert (res);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  expected.red = 1.0;
-  expected.green = 0.0;
-  expected.blue = 0.0;
-  expected.alpha = 1.0;
-  res = gdk_rgba_parse (&color, "red");
-  g_assert (res);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  expected.red = 0.0;
-  expected.green = 0x8080 / 65535.;
-  expected.blue = 1.0;
-  expected.alpha = 1.0;
-  res = gdk_rgba_parse (&color, "#0080ff");
-  g_assert (res);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  expected.red = 0.0;
-  expected.green = 0.0;
-  expected.blue = 0.0;
-  expected.alpha = 1.0;
-  res = gdk_rgba_parse (&color, "rgb(0,0,0)");
-  g_assert (res);
-  g_assert (gdk_rgba_equal (&color, &expected));
-}
-
-static void
-test_color_to_string (void)
-{
-  GdkRGBA rgba;
-  GdkRGBA out;
-  gchar *res;
-  gchar *res_de;
-  gchar *res_en;
-  gchar *orig;
-
-  /* Using /255. values for the r, g, b components should
-   * make sure they round-trip exactly without rounding
-   * from the double => integer => double conversions */
-  rgba.red = 1.0;
-  rgba.green = 128/255.;
-  rgba.blue = 64/255.;
-  rgba.alpha = 0.5;
-
-  orig = g_strdup (setlocale (LC_ALL, NULL));
-  res = gdk_rgba_to_string (&rgba);
-  gdk_rgba_parse (&out, res);
-  g_assert (gdk_rgba_equal (&rgba, &out));
-
-  setlocale (LC_ALL, "de_DE.utf-8");
-  res_de = gdk_rgba_to_string (&rgba);
-  g_assert_cmpstr (res, ==, res_de);
-
-  setlocale (LC_ALL, "en_US.utf-8");
-  res_en = gdk_rgba_to_string (&rgba);
-  g_assert_cmpstr (res, ==, res_en);
-
-  g_free (res);
-  g_free (res_de);
-  g_free (res_en);
-
-  setlocale (LC_ALL, orig);
-  g_free (orig);
-}
-
-static void
-test_color_copy (void)
-{
-  GdkRGBA rgba;
-  GdkRGBA *out;
-
-  rgba.red = 0.0;
-  rgba.green = 0.1;
-  rgba.blue = 0.6;
-  rgba.alpha = 0.9;
-
-  out = gdk_rgba_copy (&rgba);
-  g_assert (gdk_rgba_equal (&rgba, out));
-
-  gdk_rgba_free (out);
-}
-
-static void
-test_color_parse_nonsense (void)
-{
-  GdkRGBA color;
-  gboolean res;
-
-  g_test_bug ("667485");
-
-  res = gdk_rgba_parse (&color, "rgb(,,)");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(%,%,%)");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(nan,nan,nan)");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(inf,inf,inf)");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(1p12,0,0)");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(5d1%,1,1)");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(0,0,0)moo");
-  g_assert (!res);
-
-  res = gdk_rgba_parse (&color, "rgb(0,0,0)  moo");
-  g_assert (!res);
-}
-
-int
-main (int argc, char *argv[])
-{
-        g_test_init (&argc, &argv, NULL);
-
-        g_test_bug_base ("http://bugzilla.gnome.org");
-
-        g_test_add_func ("/rgba/parse", test_color_parse);
-        g_test_add_func ("/rgba/parse/nonsense", test_color_parse_nonsense);
-        g_test_add_func ("/rgba/to-string", test_color_to_string);
-        g_test_add_func ("/rgba/copy", test_color_copy);
-
-        return g_test_run ();
-}
diff --git a/gdk/tests/rgba.test.in b/gdk/tests/rgba.test.in
deleted file mode 100644 (file)
index 5fd3155..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[Test]
-Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/rgba"
-Type=session
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
new file mode 100644 (file)
index 0000000..af7953b
--- /dev/null
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.decl
+
+SUBDIRS = gdk
+
+-include $(top_srcdir)/git.mk
+
diff --git a/testsuite/gdk/Makefile.am b/testsuite/gdk/Makefile.am
new file mode 100644 (file)
index 0000000..bd9a3b3
--- /dev/null
@@ -0,0 +1,68 @@
+include $(top_srcdir)/Makefile.decl
+
+NULL=
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
+AM_CPPFLAGS = \
+       $(GDK_DEP_CFLAGS) \
+       -I$(top_srcdir) \
+       -I$(top_builddir)/gdk \
+       $(NULL)
+
+progs_ldadd = \
+       $(GDK_DEP_LIBS) \
+       $(top_builddir)/gdk/libgdk-3.la \
+       $(NULL)
+
+#TEST_PROGS              += check-gdk-cairo
+#check_gdk_cairo_SOURCES  = check-gdk-cairo.c
+#check_gdk_cairo_LDADD    = $(progs_ldadd)
+
+TEST_PROGS   += rgba
+rgba_SOURCES  = rgba.c
+rgba_LDADD    = $(progs_ldadd)
+
+TEST_PROGS        += encoding
+encoding_SOURCES   = encoding.c
+encoding_LDADD     = $(progs_ldadd)
+
+TEST_PROGS        += display
+display_SOURCES    = display.c
+display_LDADD      = $(progs_ldadd)
+
+TEST_PROGS        += keysyms
+keysyms_SOURCES    = keysyms.c
+keysyms_LDADD      = $(progs_ldadd)
+
+CLEANFILES = \
+       cairosurface.png        \
+       gdksurface.png
+
+if BUILDOPT_INSTALL_TESTS
+insttestdir=$(pkglibexecdir)/installed-tests
+insttest_PROGRAMS = $(TEST_PROGS)
+
+substitutions = \
+       -e s,@pkglibexecdir\@,$(pkglibexecdir),g \
+       $(NULL)
+
+test_in_files = \
+       rgba.test.in \
+       encoding.test.in \
+       display.test.in \
+       keysyms.test.in \
+       $(NULL)
+
+test_files = $(test_in_files:.test.in=.test)
+
+$(test_files): %.test: %.test.in
+       $(AM_V_GEN) sed $(substitutions) $< > $@.tmp && mv $@.tmp $@
+
+EXTRA_DIST += $(test_in_files)
+
+testmetadir = $(datadir)/installed-tests/$(PACKAGE)
+testmeta_DATA = $(test_files)
+endif
+
+-include $(top_srcdir)/git.mk
diff --git a/testsuite/gdk/check-gdk-cairo.c b/testsuite/gdk/check-gdk-cairo.c
new file mode 100644 (file)
index 0000000..cc7987c
--- /dev/null
@@ -0,0 +1,149 @@
+/* This file is part of GTK+
+ *
+ * AUTHORS
+ *     Sven Herzberg
+ *
+ * Copyright (C) 2008  Sven Herzberg
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include <glib/gstdio.h>
+#include <gdk/gdk.h>
+#ifdef CAIRO_HAS_QUARTZ_SURFACE
+#include <cairo-quartz.h>
+#endif
+
+static void
+test (cairo_t* cr)
+{
+       cairo_save (cr);
+        cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+        cairo_paint (cr);
+       cairo_restore (cr);
+
+       cairo_move_to (cr, 10.0, 20.0);
+       cairo_line_to (cr, 10.0, 30.0);
+       cairo_stroke (cr);
+
+       cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
+       cairo_arc (cr, 0.0, 0.0, 10.0, 0.0, G_PI/2);
+       cairo_stroke (cr);
+}
+
+static void
+test_surface_orientation (void)
+{
+       cairo_surface_t *surface;
+       GdkPixbuf* pixbuf;
+       GdkPixbuf* pbuf_platform;
+       GdkPixbuf* pbuf_imagesrf;
+       GError   * error = NULL;
+       cairo_surface_t* surface;
+       cairo_t* cr;
+       guchar* data_platform;
+       guchar* data_imagesrf;
+       guint i;
+
+       /* create "platform.png" via native cairo surface */
+       surface = gdk_window_create_similar_surface (gdk_get_default_root_window (),
+                                                     CAIRO_CONTENT_COLOR,
+                                                     100,
+                                                     80);
+       cr = cairo_create (surface);
+       test (cr);
+       cairo_destroy (cr);
+
+       pixbuf = gdk_pixbuf_get_from_surface (NULL,
+                                             surface,
+                                             0, 0,
+                                             0, 0,
+                                             100, 80);
+       if (!gdk_pixbuf_save (pixbuf, "gdksurface.png", "png", NULL, NULL)) {
+               g_error ("Eeek! Couldn't save the file \"gdksurface.png\"");
+       }
+       g_object_unref (pixbuf);
+
+       cairo_surface_destroy (surface);
+
+       /* create "cairosurface.png" via pure cairo */
+#ifndef CAIRO_HAS_QUARTZ_SURFACE
+       surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 100, 80);
+#else
+       surface = cairo_quartz_surface_create (CAIRO_FORMAT_RGB24, 100, 80);
+#endif
+       cr = cairo_create (surface);
+       test (cr);
+       cairo_destroy (cr);
+       if (CAIRO_STATUS_SUCCESS != cairo_surface_write_to_png (surface, "cairosurface.png")) {
+               g_error ("Eeek! Couldn't save the file \"cairosurface.png\"");
+       }
+       cairo_surface_destroy (surface);
+
+       /* compare the images */
+       pbuf_platform = gdk_pixbuf_new_from_file ("gdksurface.png", &error);
+       if (!pbuf_platform || error) {
+               g_error ("Eeek! Error loading \"gdksurface.png\"");
+       }
+       pbuf_imagesrf = gdk_pixbuf_new_from_file ("cairosurface.png", &error);
+       if (!pbuf_imagesrf || error) {
+               g_object_unref (pbuf_platform);
+               g_error ("Eeek! Error loading \"cairosurface.png\"");
+       }
+
+       g_assert (gdk_pixbuf_get_width (pbuf_platform) ==
+                 gdk_pixbuf_get_width (pbuf_imagesrf));
+       g_assert (gdk_pixbuf_get_height (pbuf_platform) ==
+                 gdk_pixbuf_get_height (pbuf_imagesrf));
+       g_assert (gdk_pixbuf_get_rowstride (pbuf_platform) ==
+                 gdk_pixbuf_get_rowstride (pbuf_imagesrf));
+       g_assert (gdk_pixbuf_get_n_channels (pbuf_platform) ==
+                 gdk_pixbuf_get_n_channels (pbuf_imagesrf));
+
+       data_platform = gdk_pixbuf_get_pixels (pbuf_platform);
+       data_imagesrf = gdk_pixbuf_get_pixels (pbuf_imagesrf);
+
+       for (i = 0; i < gdk_pixbuf_get_height (pbuf_platform) * gdk_pixbuf_get_rowstride (pbuf_platform); i++) {
+               if (data_platform[i] != data_imagesrf[i]) {
+                       g_warning ("Eeek! Images are differing at byte %d", i);
+                       g_object_unref (pbuf_platform);
+                       g_object_unref (pbuf_imagesrf);
+                       g_assert_not_reached ();
+               }
+       }
+
+       g_object_unref (pbuf_platform);
+       g_object_unref (pbuf_imagesrf);
+
+       g_unlink ("gdksurface.png");
+       g_unlink ("cairosurface.png");
+}
+
+int
+main (int   argc,
+      char**argv)
+{
+       g_test_init (&argc, &argv, NULL);
+       gdk_init (&argc, &argv);
+
+       g_test_add_func ("/gdk/surface/orientation",
+                        test_surface_orientation);
+
+       return g_test_run ();
+}
+
diff --git a/testsuite/gdk/display.c b/testsuite/gdk/display.c
new file mode 100644 (file)
index 0000000..b4f64ac
--- /dev/null
@@ -0,0 +1,74 @@
+#include <stdlib.h>
+
+#include <gdk/gdk.h>
+
+static void
+test_unset_display (void)
+{
+  if (g_test_trap_fork (0, 0))//G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+    {
+      GdkDisplayManager *manager;
+
+      g_unsetenv ("DISPLAY");
+
+      g_assert (!gdk_init_check (NULL, NULL));
+      manager = gdk_display_manager_get ();
+      g_assert (manager != NULL);
+      g_assert (gdk_display_manager_get_default_display (manager) == NULL);
+
+      exit (0);
+    }
+  g_test_trap_assert_passed ();
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+    {
+      g_unsetenv ("DISPLAY");
+
+      gdk_init (NULL, NULL);
+
+      exit (0);
+    }
+  g_test_trap_assert_failed ();
+  g_test_trap_assert_stderr ("*cannot open display*");
+}
+
+static void
+test_bad_display (void)
+{
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+    {
+      GdkDisplayManager *manager;
+
+      g_setenv ("DISPLAY", "poo", TRUE);
+
+      g_assert (!gdk_init_check (NULL, NULL));
+      manager = gdk_display_manager_get ();
+      g_assert (manager != NULL);
+      g_assert (gdk_display_manager_get_default_display (manager) == NULL);
+
+      exit (0);
+    }
+  g_test_trap_assert_passed ();
+
+  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+    {
+      g_setenv ("DISPLAY", "poo", TRUE);
+
+      gdk_init (NULL, NULL);
+
+      exit (0);
+    }
+  g_test_trap_assert_failed ();
+  g_test_trap_assert_stderr ("*cannot open display*");
+}
+
+int
+main (int argc, char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/display/unset-display", test_unset_display);
+  g_test_add_func ("/display/bad-display", test_bad_display);
+
+  return g_test_run ();
+}
diff --git a/testsuite/gdk/display.test.in b/testsuite/gdk/display.test.in
new file mode 100644 (file)
index 0000000..9875c68
--- /dev/null
@@ -0,0 +1,3 @@
+[Test]
+Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/display"
+Type=session
diff --git a/testsuite/gdk/encoding.c b/testsuite/gdk/encoding.c
new file mode 100644 (file)
index 0000000..546bf29
--- /dev/null
@@ -0,0 +1,46 @@
+#include <gdk/gdk.h>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/x11/gdkx.h>
+#endif
+
+static void
+test_to_text_list (void)
+{
+  GdkDisplay *display;
+
+  display = gdk_display_get_default ();
+
+#ifdef GDK_WINDOWING_X11
+  if (GDK_IS_X11_DISPLAY (display))
+    {
+      GdkAtom encoding;
+      gint format;
+      const guchar *text;
+      gint length;
+      gchar **list;
+      gint n;
+
+      encoding = gdk_atom_intern ("UTF8_STRING", FALSE);
+      format = 8;
+      text = (const guchar*)"abcdef \304\201 \304\205\0ABCDEF \304\200 \304\204";
+      length = 25;
+      n = gdk_x11_display_text_property_to_text_list (display, encoding, format, text, length, &list);
+      g_assert_cmpint (n, ==, 2);
+      g_assert (g_str_has_prefix (list[0], "abcdef "));
+      g_assert (g_str_has_prefix (list[1], "ABCDEF "));
+
+      gdk_x11_free_text_list (list);
+    }
+#endif
+}
+
+int
+main (int argc, char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+  gdk_init (&argc, &argv);
+
+  g_test_add_func ("/encoding/to-text-list", test_to_text_list);
+
+  return g_test_run ();
+}
diff --git a/testsuite/gdk/encoding.test.in b/testsuite/gdk/encoding.test.in
new file mode 100644 (file)
index 0000000..06a329d
--- /dev/null
@@ -0,0 +1,3 @@
+[Test]
+Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/encoding"
+Type=session
diff --git a/testsuite/gdk/keysyms.c b/testsuite/gdk/keysyms.c
new file mode 100644 (file)
index 0000000..7d786f5
--- /dev/null
@@ -0,0 +1,69 @@
+#include <locale.h>
+#include <gdk/gdk.h>
+
+static void
+test_keysyms_basic (void)
+{
+  struct {
+    guint keyval;
+    const gchar *name;
+    const gchar *other_name;
+  } tests[] = {
+    { GDK_KEY_space, "space", NULL },
+    { GDK_KEY_a, "a", NULL },
+    { GDK_KEY_Thorn, "Thorn", "THORN" },
+    { GDK_KEY_Hangul_J_RieulTieut, "Hangul_J_RieulTieut", NULL },
+    { GDK_KEY_Page_Up, "Page_Up", NULL },
+    { GDK_KEY_KP_Multiply, "KP_Multiply", NULL },
+    { GDK_KEY_MonBrightnessUp, "MonBrightnessUp", NULL },
+    { 0, NULL }
+  };
+  gint i;
+
+ for (i = 0; tests[i].keyval != 0; i++)
+   {
+     g_assert_cmpstr (gdk_keyval_name (tests[i].keyval), ==, tests[i].name);
+     g_assert_cmpuint (gdk_keyval_from_name (tests[i].name), ==, tests[i].keyval);
+     if (tests[i].other_name)
+       g_assert_cmpuint (gdk_keyval_from_name (tests[i].other_name), ==, tests[i].keyval);
+   }
+}
+
+static void
+test_keysyms_void (void)
+{
+  g_assert_cmpuint (gdk_keyval_from_name ("NoSuchKeysym"), ==, GDK_KEY_VoidSymbol);
+  g_assert_cmpstr (gdk_keyval_name (GDK_KEY_VoidSymbol), ==, "0xffffff");
+}
+
+static void
+test_keysyms_xf86 (void)
+{
+  g_assert_cmpuint (gdk_keyval_from_name ("XF86MonBrightnessUp"), ==, GDK_KEY_MonBrightnessUp);
+  g_assert_cmpuint (gdk_keyval_from_name ("XF86MonBrightnessDown"), ==, GDK_KEY_MonBrightnessDown);
+  g_assert_cmpuint (gdk_keyval_from_name ("XF86KbdBrightnessUp"), ==, GDK_KEY_KbdBrightnessUp);
+  g_assert_cmpuint (gdk_keyval_from_name ("XF86KbdBrightnessDown"), ==, GDK_KEY_KbdBrightnessDown);
+  g_assert_cmpuint (gdk_keyval_from_name ("XF86Battery"), ==, GDK_KEY_Battery);
+  g_assert_cmpuint (gdk_keyval_from_name ("XF86Display"), ==, GDK_KEY_Display);
+
+  g_assert_cmpuint (gdk_keyval_from_name ("MonBrightnessUp"), ==, GDK_KEY_MonBrightnessUp);
+  g_assert_cmpuint (gdk_keyval_from_name ("MonBrightnessDown"), ==, GDK_KEY_MonBrightnessDown);
+  g_assert_cmpuint (gdk_keyval_from_name ("KbdBrightnessUp"), ==, GDK_KEY_KbdBrightnessUp);
+  g_assert_cmpuint (gdk_keyval_from_name ("KbdBrightnessDown"), ==, GDK_KEY_KbdBrightnessDown);
+  g_assert_cmpuint (gdk_keyval_from_name ("Battery"), ==, GDK_KEY_Battery);
+  g_assert_cmpuint (gdk_keyval_from_name ("Display"), ==, GDK_KEY_Display);
+}
+
+int main (int argc, char *argv[])
+{
+  setlocale (LC_ALL, "");
+
+  g_test_init (&argc, &argv, NULL);
+  gdk_init (&argc, &argv);
+
+  g_test_add_func ("/keysyms/basic", test_keysyms_basic);
+  g_test_add_func ("/keysyms/void", test_keysyms_void);
+  g_test_add_func ("/keysyms/xf86", test_keysyms_xf86);
+
+  return g_test_run ();
+}
diff --git a/testsuite/gdk/keysyms.test.in b/testsuite/gdk/keysyms.test.in
new file mode 100644 (file)
index 0000000..2f1ce97
--- /dev/null
@@ -0,0 +1,3 @@
+[Test]
+Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/keysyms"
+Type=session
diff --git a/testsuite/gdk/rgba.c b/testsuite/gdk/rgba.c
new file mode 100644 (file)
index 0000000..fa2da62
--- /dev/null
@@ -0,0 +1,164 @@
+#include <locale.h>
+#include <gdk/gdk.h>
+
+static void
+test_color_parse (void)
+{
+  GdkRGBA color;
+  GdkRGBA expected;
+  gboolean res;
+
+  res = gdk_rgba_parse (&color, "foo");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "");
+  g_assert (!res);
+
+  expected.red = 100/255.;
+  expected.green = 90/255.;
+  expected.blue = 80/255.;
+  expected.alpha = 0.1;
+  res = gdk_rgba_parse (&color, "rgba(100,90,80,0.1)");
+  g_assert (res);
+  g_assert (gdk_rgba_equal (&color, &expected));
+
+  expected.red = 0.4;
+  expected.green = 0.3;
+  expected.blue = 0.2;
+  expected.alpha = 0.1;
+  res = gdk_rgba_parse (&color, "rgba(40%,30%,20%,0.1)");
+  g_assert (res);
+  g_assert (gdk_rgba_equal (&color, &expected));
+
+  res = gdk_rgba_parse (&color, "rgba(  40 % ,  30 %  ,   20 % ,  0.1    )");
+  g_assert (res);
+  g_assert (gdk_rgba_equal (&color, &expected));
+
+  expected.red = 1.0;
+  expected.green = 0.0;
+  expected.blue = 0.0;
+  expected.alpha = 1.0;
+  res = gdk_rgba_parse (&color, "red");
+  g_assert (res);
+  g_assert (gdk_rgba_equal (&color, &expected));
+
+  expected.red = 0.0;
+  expected.green = 0x8080 / 65535.;
+  expected.blue = 1.0;
+  expected.alpha = 1.0;
+  res = gdk_rgba_parse (&color, "#0080ff");
+  g_assert (res);
+  g_assert (gdk_rgba_equal (&color, &expected));
+
+  expected.red = 0.0;
+  expected.green = 0.0;
+  expected.blue = 0.0;
+  expected.alpha = 1.0;
+  res = gdk_rgba_parse (&color, "rgb(0,0,0)");
+  g_assert (res);
+  g_assert (gdk_rgba_equal (&color, &expected));
+}
+
+static void
+test_color_to_string (void)
+{
+  GdkRGBA rgba;
+  GdkRGBA out;
+  gchar *res;
+  gchar *res_de;
+  gchar *res_en;
+  gchar *orig;
+
+  /* Using /255. values for the r, g, b components should
+   * make sure they round-trip exactly without rounding
+   * from the double => integer => double conversions */
+  rgba.red = 1.0;
+  rgba.green = 128/255.;
+  rgba.blue = 64/255.;
+  rgba.alpha = 0.5;
+
+  orig = g_strdup (setlocale (LC_ALL, NULL));
+  res = gdk_rgba_to_string (&rgba);
+  gdk_rgba_parse (&out, res);
+  g_assert (gdk_rgba_equal (&rgba, &out));
+
+  setlocale (LC_ALL, "de_DE.utf-8");
+  res_de = gdk_rgba_to_string (&rgba);
+  g_assert_cmpstr (res, ==, res_de);
+
+  setlocale (LC_ALL, "en_US.utf-8");
+  res_en = gdk_rgba_to_string (&rgba);
+  g_assert_cmpstr (res, ==, res_en);
+
+  g_free (res);
+  g_free (res_de);
+  g_free (res_en);
+
+  setlocale (LC_ALL, orig);
+  g_free (orig);
+}
+
+static void
+test_color_copy (void)
+{
+  GdkRGBA rgba;
+  GdkRGBA *out;
+
+  rgba.red = 0.0;
+  rgba.green = 0.1;
+  rgba.blue = 0.6;
+  rgba.alpha = 0.9;
+
+  out = gdk_rgba_copy (&rgba);
+  g_assert (gdk_rgba_equal (&rgba, out));
+
+  gdk_rgba_free (out);
+}
+
+static void
+test_color_parse_nonsense (void)
+{
+  GdkRGBA color;
+  gboolean res;
+
+  g_test_bug ("667485");
+
+  res = gdk_rgba_parse (&color, "rgb(,,)");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(%,%,%)");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(nan,nan,nan)");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(inf,inf,inf)");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(1p12,0,0)");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(5d1%,1,1)");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(0,0,0)moo");
+  g_assert (!res);
+
+  res = gdk_rgba_parse (&color, "rgb(0,0,0)  moo");
+  g_assert (!res);
+}
+
+int
+main (int argc, char *argv[])
+{
+        g_test_init (&argc, &argv, NULL);
+
+        g_test_bug_base ("http://bugzilla.gnome.org");
+
+        g_test_add_func ("/rgba/parse", test_color_parse);
+        g_test_add_func ("/rgba/parse/nonsense", test_color_parse_nonsense);
+        g_test_add_func ("/rgba/to-string", test_color_to_string);
+        g_test_add_func ("/rgba/copy", test_color_copy);
+
+        return g_test_run ();
+}
diff --git a/testsuite/gdk/rgba.test.in b/testsuite/gdk/rgba.test.in
new file mode 100644 (file)
index 0000000..5fd3155
--- /dev/null
@@ -0,0 +1,3 @@
+[Test]
+Exec=/bin/sh -c "@pkglibexecdir@/installed-tests/rgba"
+Type=session